using System;
using System.Collections.Generic;
using Castle.ActiveRecord;

namespace Library.Core.Model
{
    [ActiveRecord(Lazy = true)]
    public class Customer
    {
        [PrimaryKey(PrimaryKeyType.Native, ColumnType = "Int64", Length = 64)]
        public virtual long Id { get; set; }

        [Property(ColumnType = "String", Length = 64)]
        public virtual string FirstName { get; set; }

        [Property(ColumnType = "String", Unique = true)]
        public virtual string LasName { get; set; }

        [Property(ColumnType = "DateTime")]
        public virtual DateTime BirthDate { get; set; }

        [Property(ColumnType = "String")]
        public virtual string City { get; set; }

        [Property(ColumnType = "String", Length = 64)]
        public virtual string Country { get; set; }

        [HasAndBelongsToMany(typeof (Product), ColumnRef = "IdProduct", ColumnKey = "IdCustomer", Inverse = true,
            Lazy = true, Table = "CustomerProduct")]
        public virtual IList<Product> Products { get; set; }
    }
}
